<?php
/**
 * 帮助中心控制层
 * 
 * @copyright 	Copyright (c) 2011 thinkapk.com All rights reserved.
 * @package 	ThinkAPK_Action
 * @link 		http://www.thinkapk.com/
 * @author 		richie <richbossman@163.com>
 * @version 	$Id: HelpAction.class.php 7600 2011-06-03 03:36:36Z yemusheng $
 * 
 */
class HelpAction extends ThinkAPK_Action_Mall{
	
	function _before_index(){
		$help = D('Article')->getByArticle_id($_GET['id']);
		if(!$help){
			$this->error('');
		}
		//跳转
		if(!empty($help['link']) && $help['link'] != 'http://'){
			header('Location:'.$help['link']);
		}
		$this->setTitle($help['title']);
		$this->setKeywords($help['keywords']);
		$this->setDescription($help['article_attr']);
		$this->setPosition(0, '帮助中心');
		$this->assign('helpinfo', $help);
	}
	
	/*
	 * AJAX使用帮助信息
	*/
	public function getHelp(){
		$type=$_GET['type']?$_GET['type']:$this->error('没指定帮助类型');
		$cache_name="__help_{$type}__";
		$help=F($cache_name);
		if(!$help){
			$help=D('ShopConfig')->getConfigInfo($type);
			F($cache_name,$help);
		}
		if($help){
			$this->success($help);
		}else{
			$this->error('此类型没有帮助信息');
		}
		
	}
}
?>